﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Lidgren.Network;
using Kaleta.Network.Serialization;

namespace Kaleta.Outcast.Network
{
    public class Vector2DataSerializer : IDataTypeSerialization
    {
        public void WriteData(ref object data, ref NetBuffer sendBuffer)
        {
            Vector2 vector = (Vector2)data;

            sendBuffer.Write(vector.X);
            sendBuffer.Write(vector.Y);
        }

        public object ReadData(ref NetBuffer readBuffer)
        {
            return new Vector2() { X = readBuffer.ReadSingle(), Y = readBuffer.ReadSingle() };
        }
    }
}
